<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./OL_SDK/include-openlayers-local.js"></script>
    <script src="./libs/gaode.js"></script>
</head>

<body>
    <div id="map">
    </div>
    <script>
        var map = new ol.Map({
            target: "map",
            layers: [gaode],
            view: new ol.View({
                projection: 'EPSG:4326',
                center: [114.30, 30.50],
                zoom: 4
            })
        })
        var data = {
            type: "FeatureCollection",
            features: [
                {
                    type: "Feature",
                    geometry: {
                        type: "Point",
                        coordinates: [114.30, 30.50]
                    },
                    properties: {
                        id: 1001,
                        name: "武汉"
                    }
                },
                {
                    type: "Feature",
                    geometry: {
                        type: "Point",
                        coordinates: [118, 30.50]
                    },
                    properties: {
                        id: 1002,
                        name: "苏州"
                    }
                }
            ]
        }
        /* geojson数据转化ol-feature */
        var features = new ol.format.GeoJSON().readFeatures(data);
        // console.log(features,'features')// [e,e]
        // console.log(features[1].get("name"))// '苏州'
        var source = new ol.source.Vector({
            features // 数组
        })
        var layer = new ol.layer.Vector({
            source
        })
        map.addLayer(layer)
    </script>
</body>

</html>